#pragma once
#pragma warning(disable:4996)       // disable checked iterator errors http://msdn.microsoft.com/en-us/library/aa985965(VS.80).aspx 

//
// Copyright (C) 2011 Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.101

#include <Macros.h>
#include <CoVector.h>
#include <CoMatrix.h>
#include <CoCube.h>
#include <ValueHelpers.h>
#include <Settings.h>

#include <gen/QL/Processes/ForwardMeasureProcess.h>
#pragma unmanaged 
#include <ql\processes\g2process.hpp>
#include <boost/smart_ptr/detail/spinlock.hpp>
#pragma managed 

using namespace System;
using namespace QuantLib;
using namespace Cephei;

using namespace Cephei::QL::Math;
#define HANDLE
#undef ABSTRACT
#undef STRUCT
namespace Cephei { namespace QL { namespace Processes {
	//////////////////////////////////////////////////////////////////////////////////////////////
	// implementation of IG2ForwardProcess
	public ref class CG2ForwardProcess : 
            public CForwardMeasureProcess,
            public Cephei::QL::Processes::IG2ForwardProcess
	{
	protected: 
		boost::shared_ptr<QuantLib::G2ForwardProcess>* _ppG2ForwardProcess;
#ifdef HANDLE
		QuantLib::Handle<QuantLib::G2ForwardProcess>* _phG2ForwardProcess;
#endif
		Object^ _G2ForwardProcessOwner;     // reference to object that manages the storage for this object
	internal:
		CG2ForwardProcess (Double a, Double sigma, Double b, Double eta, Double rho);
        CG2ForwardProcess (boost::shared_ptr<QuantLib::G2ForwardProcess>& childNative, Object^ owner);
        CG2ForwardProcess (QuantLib::G2ForwardProcess& childNative, Object^ owner);
        CG2ForwardProcess (CG2ForwardProcess^ copy);
        CG2ForwardProcess (System::Type^ t);
#ifdef STRUCT
        CG2ForwardProcess (QuantLib::G2ForwardProcess childNative);
#endif       
#ifdef HANDLE
		CG2ForwardProcess (QuantLib::Handle<QuantLib::G2ForwardProcess>& childNative, Object^ owner);
		CG2ForwardProcess (QuantLib::Handle<QuantLib::G2ForwardProcess> childNative);
#endif
		virtual ~CG2ForwardProcess ();
		!CG2ForwardProcess ();

	internal:
		QuantLib::G2ForwardProcess& GetReference ();
		boost::shared_ptr<QuantLib::G2ForwardProcess>& GetShared ();
		QuantLib::G2ForwardProcess* GetPointer ();
        void SetG2ForwardProcess (boost::shared_ptr<QuantLib::G2ForwardProcess> native)
        {
            if (_ppG2ForwardProcess != NULL)
                delete _ppG2ForwardProcess;
            _ppG2ForwardProcess = new boost::shared_ptr<QuantLib::G2ForwardProcess> (native);
            SetForwardMeasureProcess (boost::dynamic_pointer_cast<QuantLib::ForwardMeasureProcess> (*_ppG2ForwardProcess));
        }
#ifdef HANDLE
		QuantLib::Handle<QuantLib::G2ForwardProcess>& GetHandle ();
#endif
		virtual bool HasNative () override;
    public:
        property UInt64 Size 
        {
		    virtual UInt64 get () ;
        }
    };
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Factory class
	public ref class CG2ForwardProcess_Factory : public System::MarshalByRefObject,  public IG2ForwardProcess_Factory
	{
	public:
        virtual IG2ForwardProcess^ Create (Double a, Double sigma, Double b, Double eta, Double rho);
    };
   
/*Cephei*/ } /*QL*/ } /*Processes */}
